<?php
	
	namespace Aspic\Form\Element;
	use Aspic\Security\Security as S;
	
	/**
	* TextArea form element
	*/
	class TextArea extends AbstractStandardElement {
		protected $_contents;
	
		public function __construct($name, $label = '', array $options = array(), array $attributes = array()) {
			parent::__construct($name, $label, $options, $attributes);
			
			$this->opt('contents', '', true);
		}
		
		public function outInput() {
			$out = '<textarea '.$this->getAttrsAndNameStr().'>'.S::escapeXss($this->opt('contents')).'</textarea>';
			
			return $out;
		}
		
		protected function getDefaultId() {
			return 'ta'.ucfirst($this->getName());
		}
		
		public function bind(array $formData = null) {
			if($value = $this->getValue($formData)) {
				$this->opt('contents', $value);
			}
		}
		
	}	
	
?>